package app.server.project.main.service.dto.cms;

import app.server.project.main.service.db.entity.user.UserInfoEntity;
import app.server.project.main.service.dto.EnergyDto;
import app.server.project.main.service.dto.lv.LvDto;
import app.server.project.main.service.dto.race.AiCoinDto;
import cn.hutool.core.bean.BeanUtil;
import lombok.Data;

@Data
public class UserInfoResp {
    /**
     * 等级信息
     */
    private LvDto lvDto;
    /**
     * ai coin金币
     */
    private AiCoinDto aiCoinDto;
    /**
     * 体力值模块
     */
    private EnergyDto energyDto;

    private String nick;

    private String headUrl;

    private int btcType;

    private int vipType;

    private String userId;

    private String version;

    private int unlockRaceAll;

    private long propClickNum;

    private long chanceTime;

    public static UserInfoResp of(UserInfoEntity userInfoEntity, EnergyDto energyDto, LvDto lvDto, AiCoinDto aiCoin) {
        var ret = new UserInfoResp();
        BeanUtil.copyProperties(userInfoEntity, ret, true);
        ret.setLvDto(lvDto);
        ret.setAiCoinDto(aiCoin);
        ret.setEnergyDto(energyDto);
        return ret;
    }

    public static UserInfoResp ofInvite(UserInfoEntity userInfoEntity, int btcType, int vipType) {
        var ret = new UserInfoResp();
        BeanUtil.copyProperties(userInfoEntity, ret, true);
        ret.setBtcType(btcType);
        ret.setVipType(vipType);
        ret.setUserId(String.valueOf(userInfoEntity.getUserId()));
        return ret;
    }
}
